💳 Gift Card Subset Solver (Backtracking)

Input Parameters

Mythili's Gift Card Challenge

Given a list of item prices and a gift card balance (target), the task is to determine if a **subset** of items exists whose total price exactly equals the gift card balance. If multiple exist, we must find and output the **first one found** by the search process.

Required Calculation and Output

  • **Line 1:** Print the result of the formula: $Target \times 2 - 1$.
  • **Line 2:** Print the space-separated item prices of the **first occurring combination** that matches the target, or "No combination of items."

Sample Input/Output

Input (Sample 1 - Success):
3
10 20 30
50

Output:
99
20 30
                
Input (Sample 2 - Failure):
4
10 15 20 30
58

Output:
115
No combination of items